package util

import "cmp"

func MergeMaps[K comparable, V cmp.Ordered](maps ...map[K]V) map[K]V {
	totalMap := make(map[K]V)
	for _, tempMap :=  range maps {
		for key, value := range tempMap {
			if _, ok := totalMap[key]; !ok {
				totalMap[key] = value
			} else {
				totalMap[key] += value
			}
		}
	}
	return totalMap
}
